//
//  ReadCollectionViewCell.m
//  片刻
//
//  Created by lanou3g on 15/6/4.
//  Copyright (c) 2015年 lanou3g. All rights reserved.
//

#import "ReadCollectionViewCell.h"
#import <UIImageView+WebCache.h>
@implementation ReadCollectionViewCell
-(void)dealloc
{
    _imageView = nil;
    _nameLabel = nil;
    _model = nil;
    [super dealloc];
}
-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        _imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
        [self.contentView addSubview:_imageView];
        _nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(2, 80, 96, 20)];
        [_nameLabel setTextColor:[UIColor whiteColor]]; //字体颜色
        _nameLabel.font = [UIFont systemFontOfSize:13];
        [self.contentView addSubview:_nameLabel];
        
        [_imageView release];
        [_nameLabel release];
    }
    return self;
}
-(void)setModel:(ReadModel *)model
{
    if (_model != model) {
        [_model release];
        _model = [model retain];
        
        [_imageView sd_setImageWithURL:[NSURL URLWithString:model.coverimg]];
        _nameLabel.text = [NSString stringWithFormat:@"%@ %@",model.name,model.enname];
    }
}
@end
